package com.schillerchina.baselibrary.network;

import android.app.Application;
import android.content.Context;


/**
 * @author zhangzhiguo
 * @date 2019-08-05 09:39
 * @Description:
 */
public class App {
    private static Context context;

    static {
        try {
            context = (Application) Class.forName("android.app.ActivityThread").getMethod
                    ("currentApplication").invoke(null, (Object[]) null);
            if (context == null) {
                context = (Application) Class.forName("android.app.AppGlobals").getMethod
                        ("getInitialApplication").invoke(null, (Object[]) null);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static Context getContext() {
        return context;
    }
}
